home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / M / Moniker 2.0.1 ƒ / Source ƒ / Moniker 2.0.1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-20  |  1.1 KB  |  59 lines  |  [TEXT/KAHL]

  1. /* Moniker 2.0.1 */
  2. /* Copyright ©1992 by Michael J. Simms */
  3. /* Modified 12/20/92 by Sean Hummel */
  4.  
  5.  
  6. /* Include the program header. */
  7. #include "Moniker 2.0.1.h"
  8. #include "AppleEvents.h"
  9.  
  10. /* Function prototypes. */
  11. int main(void);
  12. static Boolean theKey(short k);
  13.  
  14.  
  15. /* Global variable. */
  16. Boolean    gQuitDemand=FALSE;
  17. Boolean gNameManually = TRUE;
  18.  
  19.  
  20. main(void)
  21. /* The driver - head honcho. */
  22. {
  23.     Boolean        gotEvent,canRun;
  24.     EventRecord    event;
  25.  
  26.     /* Call initialization routine. */
  27.     initialize();
  28.  
  29.     /* See if the program can run. */
  30.     canRun=canRunProgram();
  31.  
  32.     /* If the program can run then do so. */
  33.     if (canRun) {
  34.         /* Install Apple Event handlers. */
  35.         installAEHandlers();
  36.  
  37.         if (theKey(0x3A))  gNameManually = FALSE; 
  38.         
  39.         /* Main loop. */        
  40.         do {
  41.             if (gotEvent=WaitNextEvent(highLevelEventMask,&event,kSleep,NIL))
  42.                 AEProcessAppleEvent(&event);
  43.         } while (!gQuitDemand);
  44.  
  45.         /* Remove Apple Event handlers. */
  46.         removeAEHandlers();
  47.     } else describeError(kCantRun);
  48. }
  49.  
  50. static Boolean theKey(short k)
  51. {
  52.     unsigned char km[16];
  53.     
  54.     GetKeys(km);
  55.     return ((km[k>>3]>>(k&7)) & 1);
  56. }
  57.     
  58.     
  59.